package com.app.command;

import java.io.BufferedReader;



import com.app.dao.BaseDAO;
import com.app.dao.BookDAO;
import com.app.dao.entity.Book;

public class FindBookByID extends Command {

	@Override
	protected CommandResult execute(BufferedReader dataLineReader) throws Exception {
		CommandResult result = new CommandResult(CommandResultStatus.SUCCESSFUL);
		BookDAO bookDAO = new BookDAO();
		BaseDAO.beginTransaction();
		
		
			
			System.out.print(" Enter BookID ");
			Long id = new Long(dataLineReader.readLine());
			Book book = bookDAO.findByID(id);
			if (book != null) {
				System.out.println("ID" + book);
			} else {
				System.out.println("Book " + id
						+ " not find");

			}
			return result;

		
	}
}
